﻿namespace GreenIsomer.Data.Entities.Ddl {

	public class PrimaryKey {

		private ColumnRefCollection columns;

		public PrimaryKey() {
			columns = new ColumnRefCollection();
		}

		public string Name { get; set; }

		public ColumnRefCollection Columns {
			get { return columns; }
		}

		public virtual void WriteCreateScript(DdlWriter writer) {

			writer.StartNewLine();

			writer.WriteScript("CONSTRAINT");

			writer.AddSpace();
			writer.WriteName(Name);
			writer.AddSpace();

			writer.WriteScript("PRIMARY KEY");

			writer.AddSpace();
			Columns.WriteScript(writer);
		}

	}

}